from django_filters.filters import *

from apps.clsbb.models import *
from django_filters.rest_framework import FilterSet

from apps.pam.models import Pam_business_opportunity_Records, Pam_Contract_tobesigned_Records, \
    Pam_contract_management_Records, Pam_framecontract_order_Records, Pam_framecontract_order_whole_Records, \
    Pam_singlecontract_order_whole_Records, Pam_supplier_management_Records


class Pam_business_opportunity_RecordsFilter(FilterSet):
    """
    Pam_business_opportunity_Records过滤
    """
    add_time_begin = DateFilter(field_name="add_time",help_text="开始创建时间",lookup_expr="gte")
    add_time_end = DateFilter(field_name="add_time",help_text="结束创建时间",lookup_expr="lte")
    Update_time_begin = DateFilter(field_name="update_time",help_text="开始更新时间",lookup_expr="gte")
    Update_time_end = DateFilter(field_name="update_time",help_text="结束更新时间",lookup_expr="lte")
    region_shi = CharFilter(field_name="region",help_text="区县_市",lookup_expr="icontains")
    region_xian = CharFilter(field_name="region",help_text="区县_县",lookup_expr="icontains")
    class Meta:
        model = Pam_business_opportunity_Records
        fields = ['company','region_shi','region_xian', 'next_checker','is_effective',
                  'add_time_begin','add_time_end',
                  'Update_time_begin','Update_time_end',
                  'del_flag',
                  'name']


class Pam_Contract_tobesigned_RecordsFilter(FilterSet):
    """
    Pam_Contract_tobesigned_Records过滤
    """
    add_time_begin = DateFilter(field_name="add_time",help_text="开始创建时间",lookup_expr="gte")
    add_time_end = DateFilter(field_name="add_time",help_text="结束创建时间",lookup_expr="lte")
    Update_time_begin = DateFilter(field_name="update_time",help_text="开始更新时间",lookup_expr="gte")
    Update_time_end = DateFilter(field_name="update_time",help_text="结束更新时间",lookup_expr="lte")
    region_shi = CharFilter(field_name="region",help_text="区县_市",lookup_expr="icontains")
    region_xian = CharFilter(field_name="region",help_text="区县_县",lookup_expr="icontains")
    class Meta:
        model = Pam_Contract_tobesigned_Records
        fields = ['company','region_shi','region_xian', 'next_checker','is_effective',
                  'add_time_begin','add_time_end',
                  'Update_time_begin','Update_time_end',
                  'del_flag',
                  'name']


class Pam_contract_management_RecordsFilter(FilterSet):
    """
    Pam_contract_management_Records过滤
    """
    add_time_begin = DateFilter(field_name="add_time",help_text="开始创建时间",lookup_expr="gte")
    add_time_end = DateFilter(field_name="add_time",help_text="结束创建时间",lookup_expr="lte")
    Update_time_begin = DateFilter(field_name="update_time",help_text="开始更新时间",lookup_expr="gte")
    Update_time_end = DateFilter(field_name="update_time",help_text="结束更新时间",lookup_expr="lte")
    region_shi = CharFilter(field_name="region",help_text="区县_市",lookup_expr="icontains")
    region_xian = CharFilter(field_name="region",help_text="区县_县",lookup_expr="icontains")
    class Meta:
        model = Pam_contract_management_Records
        fields = ['company','region_shi','region_xian', 'next_checker','is_effective',
                  'add_time_begin','add_time_end',
                  'Update_time_begin','Update_time_end',
                  'is_frame',
                  'del_flag',
                  'name']


class Pam_framecontract_order_RecordsFilter(FilterSet):
    """
    Pam_framecontract_order_Records过滤
    """
    add_time_begin = DateFilter(field_name="add_time",help_text="开始创建时间",lookup_expr="gte")
    add_time_end = DateFilter(field_name="add_time",help_text="结束创建时间",lookup_expr="lte")
    Update_time_begin = DateFilter(field_name="update_time",help_text="开始更新时间",lookup_expr="gte")
    Update_time_end = DateFilter(field_name="update_time",help_text="结束更新时间",lookup_expr="lte")
    class Meta:
        model = Pam_framecontract_order_Records
        fields = ['company','next_checker','is_effective',
                  'add_time_begin','add_time_end',
                  'Update_time_begin','Update_time_end',
                  'del_flag',
                  'name']


class Pam_framecontract_order_whole_RecordsFilter(FilterSet):
    """
    Pam_framecontract_order_whole_Records过滤
    """
    company = CharFilter(field_name="pam_framecontract_order__company",help_text="公司")
    add_time_begin = DateFilter(field_name="add_time",help_text="开始创建时间",lookup_expr="gte")
    add_time_end = DateFilter(field_name="add_time",help_text="结束创建时间",lookup_expr="lte")
    Update_time_begin = DateFilter(field_name="update_time",help_text="开始更新时间",lookup_expr="gte")
    Update_time_end = DateFilter(field_name="update_time",help_text="结束更新时间",lookup_expr="lte")
    class Meta:
        model = Pam_framecontract_order_whole_Records
        fields = [
            'company',
            'next_checker','is_effective',
                  'add_time_begin','add_time_end',
                  'Update_time_begin','Update_time_end',
                  'del_flag',
                  'name']


class Pam_singlecontract_order_whole_RecordsFilter(FilterSet):
    """
    Pam_singlecontract_order_whole_Records过滤
    """
    company = CharFilter(field_name="pam_contract_management__company",help_text="公司")
    add_time_begin = DateFilter(field_name="add_time",help_text="开始创建时间",lookup_expr="gte")
    add_time_end = DateFilter(field_name="add_time",help_text="结束创建时间",lookup_expr="lte")
    Update_time_begin = DateFilter(field_name="update_time",help_text="开始更新时间",lookup_expr="gte")
    Update_time_end = DateFilter(field_name="update_time",help_text="结束更新时间",lookup_expr="lte")
    class Meta:
        model = Pam_singlecontract_order_whole_Records
        fields = [
            'company',
            'next_checker','is_effective',
                  'add_time_begin','add_time_end',
                  'Update_time_begin','Update_time_end',
                  'del_flag',
                  'name']


class Clsbbalk_RecordsFilter(FilterSet):
    """
    Clsbbalk_Records过滤
    """
    add_time_begin = DateFilter(field_name="add_time",help_text="开始创建时间",lookup_expr="gte")
    add_time_end = DateFilter(field_name="add_time",help_text="结束创建时间",lookup_expr="lte")
    name = CharFilter(field_name="name",help_text="名称",lookup_expr="icontains")
    keywords = CharFilter(field_name="keywords",help_text="关键词",lookup_expr="icontains")
    class Meta:
        model = Clsbbalk_Records
        fields = ['company',
                  'next_checker','is_effective',
                  'add_time_begin','add_time_end','name','keywords']


class Clsbbtbk_RecordsFilter(FilterSet):
    """
    Clsbbtbk_Records过滤
    """
    add_time_begin = DateFilter(field_name="add_time",help_text="开始创建时间",lookup_expr="gte")
    add_time_end = DateFilter(field_name="add_time",help_text="结束创建时间",lookup_expr="lte")
    name = CharFilter(field_name="name",help_text="名称",lookup_expr="icontains")
    keywords = CharFilter(field_name="keywords", help_text="关键词", lookup_expr="icontains")
    class Meta:
        model = Clsbbtbk_Records
        fields = ['company','product','industry',
                  'next_checker','is_effective',
                  'add_time_begin','add_time_end','name','keywords']


class Clsbbcpk_RecordsFilter(FilterSet):
    """
    Clsbbcpk_Records过滤
    """
    add_time_begin = DateFilter(field_name="add_time",help_text="开始创建时间",lookup_expr="gte")
    add_time_end = DateFilter(field_name="add_time",help_text="结束创建时间",lookup_expr="lte")
    name = CharFilter(field_name="name",help_text="名称",lookup_expr="icontains")
    class Meta:
        model = Clsbbcpk_Records
        fields = ['company',
                  'next_checker','is_effective',
                  'add_time_begin','add_time_end','name']


class Clsbbhzhbk_RecordsFilter(FilterSet):
    """
    Clsbbhzhbk_Records过滤
    """
    add_time_begin = DateFilter(field_name="add_time",help_text="开始创建时间",lookup_expr="gte")
    add_time_end = DateFilter(field_name="add_time",help_text="结束创建时间",lookup_expr="lte")
    name = CharFilter(field_name="name",help_text="名称",lookup_expr="icontains")
    class Meta:
        model = Clsbbhzhbk_Records
        fields = ['company',
                  'next_checker','is_effective',
                  'add_time_begin','add_time_end','name']


class Clsbbgszzk_RecordsFilter(FilterSet):
    """
    Clsbbgszzk_Records过滤
    """
    add_time_begin = DateFilter(field_name="add_time",help_text="开始创建时间",lookup_expr="gte")
    add_time_end = DateFilter(field_name="add_time",help_text="结束创建时间",lookup_expr="lte")
    name = CharFilter(field_name="name",help_text="名称",lookup_expr="icontains")
    class Meta:
        model = Clsbbgszzk_Records
        fields = ['company',
                  'next_checker','is_effective',
                  'add_time_begin','add_time_end','name']


class Clsbbryzzk_RecordsFilter(FilterSet):
    """
    Clsbbryzzk_Records过滤
    """
    add_time_begin = DateFilter(field_name="add_time",help_text="开始创建时间",lookup_expr="gte")
    add_time_end = DateFilter(field_name="add_time",help_text="结束创建时间",lookup_expr="lte")
    name = CharFilter(field_name="name",help_text="名称",lookup_expr="icontains")
    class Meta:
        model = Clsbbryzzk_Records
        fields = ['company',
                  'next_checker','is_effective',
                  'add_time_begin','add_time_end','name']



class Clsbb_Common_PdfsFilter(FilterSet):
    """
    Clsbbfak公共pdf过滤
    """
    add_time_begin = DateFilter(field_name="add_time",help_text="开始创建时间",lookup_expr="gte")
    add_time_end = DateFilter(field_name="add_time",help_text="结束创建时间",lookup_expr="lte")
    class Meta:
        model = Clsbb_Common_Pdfs
        fields = ['type','add_time_begin','add_time_end','filled_by']


class Pam_supplier_management_RecordsFilter(FilterSet):
    """
    Pam_supplier_management_Records过滤
    """
    add_time_begin = DateFilter(field_name="create_time",help_text="开始创建时间",lookup_expr="gte")
    add_time_end = DateFilter(field_name="create_time",help_text="结束创建时间",lookup_expr="lte")
    class Meta:
        model = Pam_supplier_management_Records
        fields = ['add_time_begin','add_time_end','create_by']

#
# __all__ =[
#     'Pam_business_opportunity_RecordsFilter',
#     'Clsbbfak_Common_PdfsFilter',
# ]
